package pattern.memento;


import java.util.ArrayList;

public class Main {

    public static void main(String[] args) {

        RoleOriginator role = new RoleOriginator();
        role.display();
        role.fight();
        role.display();

        System.out.println("保存上面的快照");
        RoleStateCaretaker caretaker = new RoleStateCaretaker();
        caretaker.setMemento(role.saveState());


        role.fight();
        role.fight();
        role.fight();
        role.fight();
        role.display();

        System.out.println("准备恢复快照");
        role.recoveryState(caretaker.getMemento());
        role.display();
    }
}
